/**
 *@description:
 *@file: video_postprocessing.h
 *@author: snow-tyan
 *@email: zziywang@163.com
 *@date: 21 March 2023
 *@copyright: 2018-2022 AiRiA. All rights reserved.
 */

#pragma once

#include "mygl/util.h"
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <opencv2/opencv.hpp>

namespace mygl {

class Shader;
class Texture2D;

class VideoPostProcessor {
 public:
  VideoPostProcessor(std::shared_ptr<Shader> shader, int window_width, int window_height);
  ~VideoPostProcessor();

  void BeginRender();
  void EndRender();
  void Render();

  void Clear();

 private:
  void initRenderData();
  void initFbo();

 public:
  int width;
  int height;

 private:
  GLuint ms_fbo_;
  GLuint fbo_;
  GLuint rbo_;
  GLuint vao_;
  GLuint vbo_;
  GLuint ebo_;
  std::shared_ptr<Shader> shader_;
  std::shared_ptr<Texture2D> texture2d_;
};

}  // namespace mygl
